﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package com.fminutes.vinciDll.analyze {
    import flash.events.*;
    import com.fminutes.vinciDll.*;
    import flash.utils.*;
    import flash.display.*;

    public class LisAnalyze extends AnalyzeBase {

        private var lisList:Array;
        private var loader:Loader;

        public function LisAnalyze(){
            this.lisList = [];
            super();
        }
        override public function analyze(_arg1:ByteArray, _arg2:DllFileObject, _arg3:Function):void{
            var resultObject:* = null;
            var func:* = null;
            var length:* = 0;
            var lisByteArray:* = null;
            var swfByteArray:* = null;
            var byteArray:* = _arg1;
            var dllFileObject:* = _arg2;
            var compFn:* = _arg3;
            func = function (_arg1:Event):void{
                loader.removeEventListener(Event.COMPLETE, func);
                dllFileObject.result = {
                    data:resultObject,
                    appDomain:_arg1.currentTarget.applicationDomain
                };
                dllFileObject.status = DllFileObject.LOADED;
                dllFileObject.dispatchEvent(new DllEvent(DllEvent.SWFURL_COMPLETE));
                lisList.push(dllFileObject);
                compFn();
            };
            resultObject = {};
            var resultSwfByteArray:* = new ByteArray();
            byteArray.position = 0;
            if (byteArray.readUnsignedInt() == 12345679){
                length = byteArray.readUnsignedInt();
                lisByteArray = new ByteArray();
                byteArray.readBytes(lisByteArray, 0, length);
                lisByteArray.uncompress();
                lisByteArray.position = 0;
                resultObject = lisByteArray.readObject();
                swfByteArray = new ByteArray();
                byteArray.readBytes(swfByteArray);
                resultSwfByteArray.writeBytes(swfByteArray);
            } else {
                resultObject = {};
                resultSwfByteArray.writeBytes(swfByteArray);
            };
            if (resultSwfByteArray.length){
                this.loader = new Loader();
                this.loader.loadBytes(resultSwfByteArray);
                this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, func);
            };
        }
        public function getMaterialByMid(_arg1:String):Array{
            var _local4:Object;
            var _local5:String;
            var _local2:Array = [];
            var _local3:int;
            while (_local3 < this.lisList.length) {
                _local4 = this.lisList[_local3].result;
                for (_local5 in _local4.data) {
                    if (_local4.data[_local5].mid == _arg1){
                        _local4.data[_local5]["appDomain"] = _local4.appDomain;
                        _local2.push(_local4.data[_local5]);
                    };
                };
                _local3++;
            };
            return (_local2);
        }
        public function getLisDataByMid(_arg1:String):Array{
            var _local4:Object;
            var _local5:String;
            var _local2:Array = [];
            var _local3:int;
            while (_local3 < this.lisList.length) {
                _local4 = this.lisList[_local3].result;
                for (_local5 in _local4.data) {
                    if (_local4.data[_local5].mid == _arg1){
                        _local2.push(_local4);
                        break;
                    };
                };
                _local3++;
            };
            return (_local2);
        }

    }
}//package com.fminutes.vinciDll.analyze 
